#include<stdio.h>
int main()
{
	int n,x,t,sum=0;
	scanf("%d",&n);
	while(n>0){
		x=n%10;
		sum=sum+x*x*x*x;
		n=n/10;
	}
	printf("%d",sum);
	return 0;
}